﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class 校园管理
    {
//1、假设要完成一个学校的校园管理信息系统，在员工管理系统中有不同的人员信息，
//包括学生信息、教师信息等。为学生信息、教师信息创建两个类，并在两个类中

//分别定义属性和方法，在学生类中定义编号（Id）、姓名（Name）、性别（Sex）、
//身份证号（Cardid）、联系方式（Tel）、专业（Major）、年级（Grade）7 个属性，
//并定义一个方法在控制台输出这些属性的值。
//用同样的方法创建教师信息类（Teacher），属性包括编号（Id）、姓名（Name）,
//性别 （Sex）、身份证号（Cardid）、联系方式（Tel）、职称（Title）、工资号（Wageno），
//并将上 述属性输岀到控制台。
//将 Student 类和 Teacher 类中共有的 属性抽取出来定义为一个类Person，并让Student和Teacher继承Person
//每个类都要有一个输出属性的方法。
//每个类都要有初始化数据的有参构造方法。

        static void Main(string[] args)
        {
            Student stu = new Student(0212,"张三",'男',123456,"123-4567-8989","软件开发","大二");
            stu.Sa();

            Teacher tea = new Teacher(1001, "嫦娥", '女', 147258, "111-4567-6666", "音乐老师","10086");
            tea.Sa1();

            Console.ReadKey();
        }
    }
    class Student:Person
    {
        //private int id;
        //private string name;
        //private char sex;
        //private int cardid;
        //private string tel;
        private string major;
        private string grade;
        //public int Id
        //{
        //    get { return this.id; }
        //    set { this.id = value; }
        //}
        //public string Name
        //{
        //    get { return this.name; }
        //    set { this.name = value; }
        //}
        //public char Sex 
        //{
        //    get { return this.sex; }
        //    set { this.sex = value; }
        //}
        //public int Cardid 
        //{
        //    get { return this.cardid; }
        //    set { this.cardid = value; }
        //}
        //public string Tel 
        //{
        //    get { return this.tel; }
        //    set { this.tel = value; }
        //}
        public string Major 
        {
            get { return this.major; }
            set { this.major = value; }
        }
        public string Grade 
        {
            get { return this.grade; }
            set { this.grade = value; }
        }
        public Student(int id, string name, char sex, int cardid, string tel, string major, string grade)
            : base(id, name, sex, cardid, tel)
        {
            //this.Id = id;
            //this.Name = name;
            //this.Sex = sex;
            //this.Cardid = cardid;
            //this.Tel = tel;
            this.Major = major;
            this.Grade = grade;
        }
        public void Sa() 
        {
            base.Sa2();
            Console.WriteLine("我是{0}专业，我是{1}的。",this.Major,this.Grade);
        }
    }
    class Teacher:Person
    {
        //private int id;
        //private string name;
        //private char sex;
        //private int cardid;
        //private string tel;
        private string title;
        private string wageno;
        //public int Id
        //{
        //    get { return this.id; }
        //    set { this.id = value; }
        //}
        //public string Name
        //{
        //    get { return this.name; }
        //    set { this.name = value; }
        //}
        //public char Sex
        //{
        //    get { return this.sex; }
        //    set { this.sex = value; }
        //}
        //public int Cardid
        //{
        //    get { return this.cardid; }
        //    set { this.cardid = value; }
        //}
        //public string Tel
        //{
        //    get { return this.tel; }
        //    set { this.tel = value; }
        //}
        public string Title
        {
            get { return this.title; }
            set { this.title = value; }
        }
        public string Wageno
        {
            get { return this.wageno; }
            set { this.wageno = value; }
        }
        public Teacher(int id, string name, char sex, int cardid, string tel, string title, string wageno)
            :base( id, name, sex, cardid, tel)
        {
            //this.Id = id;
            //this.Name = name;
            //this.Sex = sex;
            //this.Cardid = cardid;
            //this.Tel = tel;
            this.Title = title;
            this.Wageno = wageno;
        }
        //public Teacher() { }
        public void Sa1()
        {
            base.Sa2();
            Console.WriteLine("我是{0}，我的工资号是{1}的。", this.Title, this.Wageno);
        }
    }
    class Person 
    {
        private int id;
        private string name;
        private char sex;
        private int cardid;
        private string tel;
        public int Id
        {
            get { return this.id; }
            set { this.id = value; }
        }
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        public char Sex
        {
            get { return this.sex; }
            set { this.sex = value; }
        }
        public int Cardid
        {
            get { return this.cardid; }
            set { this.cardid = value; }
        }
        public string Tel
        {
            get { return this.tel; }
            set { this.tel = value; }
        }
        public Person(int id, string name, char sex, int cardid, string tel) 
        {
            this.Id = id;
            this.Name = name;
            this.Sex = sex;
            this.Cardid = cardid;
            this.Tel = tel;
        }
        public Person() { }
        public void Sa2() 
        {
            Console.WriteLine("我的工号是{0},我的名字是{1}，我是{2}的，我的身份证号码是{3}，我的联系方式是{4}。", this.Id, this.Name, this.Sex, this.Cardid, this.Tel);
        }
    }
}
